﻿Imports System.Data.Odbc
Public Class clsMaximosMinimos
    Private mintcIdAlmacen As Integer
    Private mintcIdProdu01 As Integer
    Private mdblcExisten01 As Double
    Private mdblcExisten02 As Double
    Private mstrcZona As String
    Private mstrcPasillo As String
    Private mstrcAnaquel As String
    Private mstrcRepisa As String
    Public Property CidProdu01() As Integer
        Get
            Return mintcIdProdu01
        End Get
        Set(ByVal value As Integer)
            mintcIdProdu01 = value
        End Set
    End Property
    Public Property cidAlmacen() As Integer
        Get
            Return mintcIdAlmacen
        End Get
        Set(ByVal value As Integer)
            mintcIdAlmacen = value
        End Set
    End Property
    Public Property cExisten01() As Double
        Get
            Return mdblcExisten01
        End Get
        Set(ByVal value As Double)
            mdblcExisten01 = value
        End Set
    End Property
    Public Property cExisten02() As Double
        Get
            Return mdblcExisten02
        End Get
        Set(ByVal value As Double)
            mdblcExisten02 = value
        End Set
    End Property
    Public Property cZona() As String
        Get
            Return mstrcZona
        End Get
        Set(ByVal value As String)
            mstrcZona = value
        End Set
    End Property
    Public Property cPasillo() As String
        Get
            Return mstrcPasillo
        End Get
        Set(ByVal value As String)
            mstrcPasillo = value
        End Set
    End Property
    Public Property cAnaquel() As String
        Get
            Return mstrcAnaquel
        End Get
        Set(ByVal value As String)
            mstrcAnaquel = value
        End Set
    End Property
    Public Property cRepisa() As String
        Get
            Return mstrcRepisa
        End Get
        Set(ByVal value As String)
            mstrcRepisa = value
        End Set
    End Property
    Public Sub New()
        mintcIdAlmacen = 0
        mintcIdProdu01 = 0
        mdblcExisten01 = 0
        mdblcExisten02 = 0
        mstrcZona = ""
        mstrcPasillo = ""
        mstrcAnaquel = ""
        mstrcRepisa = ""
    End Sub
    Public Sub Insertar_Existencias_y_Ubicaciones()
        Dim strSqlQry As String

        Dim cnConn As New OdbcConnection
        cnConn.ConnectionString = AdminPAQConnection1

        strSqlQry = "Insert Into MGW10016 " & _
                  "                  Values (" & _
                  " " & mintcIdAlmacen & "," & _
                  " " & mintcIdProdu01 & "," & _
                  " " & 0 & "," & _
                  " " & mdblcExisten01 & "," & _
                  " " & mdblcExisten02 & "," & _
                  " " & 0 & "," & _
                  " " & 0 & "," & _
                  " '" & mstrcZona & "'," & _
                  " '" & mstrcPasillo & "'," & _
                  " '" & mstrcAnaquel & "'," & _
                  " '" & mstrcRepisa & "')"

        Dim cmdInsert As New OdbcCommand
        cmdInsert.Connection = cnConn
        cmdInsert.CommandText = strSqlQry


        Try

            cnConn.Open()
            cmdInsert.ExecuteNonQuery()
            cnConn.Close()

        Catch ex As OdbcException
            MessageBox.Show(ex.Message, "System Message", MessageBoxButtons.OK, MessageBoxIcon.Error)

        Catch ex As Exception
            MessageBox.Show(ex.Message, "System Message", MessageBoxButtons.OK, MessageBoxIcon.Error)

        Finally

            If cnConn.State = ConnectionState.Open Then
                cnConn.Close()
            End If

        End Try
    End Sub
End Class
